package com.JFapp.controller;


import com.JFapp.annotation.validator.group.register;
import com.JFapp.annotation.validator.group.update;
import com.JFapp.domain.entity.ResponseResult;
import com.JFapp.domain.entity.User;
import com.JFapp.domain.vo.UserVo;
import com.JFapp.service.UserService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;



@RestController
@RequestMapping("/user")
@Api("前台用户管理")
public class UserController {
    @Autowired
    private UserService userService;


    @ApiOperation("查询个人信息")
    @GetMapping("/userInfo")
    public ResponseResult selectUserInfo(){
        return userService.selectUserInfo();
    }


    @ApiOperation("更新个人信息")
    @PutMapping("/userInfo")
    public  ResponseResult<UserVo> updateUserInfo(@RequestBody @Validated(update.class) User user){
      return userService.updateUserInfo(user);
    }


}
